[FORMAT "WCOFF"]
[INSTRSET "i486p"]
[OPTIMIZE 1]
[OPTION 1]
[BITS 32]
	EXTERN	_init_gdtidt
	EXTERN	_init_pic
	EXTERN	_io_sti
	EXTERN	_fifo32_init
	EXTERN	_init_pit
	EXTERN	_init_keyboard
	EXTERN	_enable_mouse
	EXTERN	_io_out8
	EXTERN	_memtest
	EXTERN	_memman_init
	EXTERN	_memman_free
	EXTERN	_shtctl_init
	EXTERN	_task_init
	EXTERN	_task_run
	EXTERN	_sheet_alloc
	EXTERN	_memman_alloc_4k
	EXTERN	_sheet_setbuf
	EXTERN	_init_screen8
	EXTERN	_init_mouse_cursor8
	EXTERN	_sheet_slide
	EXTERN	_sheet_updown
	EXTERN	_fifo32_put
	EXTERN	_file_readfat
	EXTERN	_file_search
	EXTERN	_file_loadfile2
	EXTERN	_memman_free_4k
	EXTERN	_fifo32_status
	EXTERN	_io_cli
	EXTERN	_fifo32_get
	EXTERN	_keytable0.0
	EXTERN	_get_day_of_month
	EXTERN	_get_mon_hex
	EXTERN	_get_year
	EXTERN	_sprintf
	EXTERN	_putfonts8_asc_sht
	EXTERN	_get_min_hex
	EXTERN	_get_hour_hex
	EXTERN	_sheet_refresh
	EXTERN	_wait_KBC_sendready
	EXTERN	_cons_putstr0
	EXTERN	_asm_end_app
	EXTERN	_keytable1.1
	EXTERN	_mouse_decode
	EXTERN	_taskctl
	EXTERN	_sheet_free
	EXTERN	_task_sleep
	EXTERN	_hankaku
	EXTERN	_change_wtitle8
	EXTERN	_task_alloc
	EXTERN	_console_task
	EXTERN	_make_window8
	EXTERN	_make_textbox8
[FILE "bootpack.c"]
[SECTION .data]
_keytable0.0:
	DB	0
	DB	0
	DB	49
	DB	50
	DB	51
	DB	52
	DB	53
	DB	54
	DB	55
	DB	56
	DB	57
	DB	48
	DB	45
	DB	61
	DB	8
	DB	0
	DB	81
	DB	87
	DB	69
	DB	82
	DB	84
	DB	89
	DB	85
	DB	73
	DB	79
	DB	80
	DB	91
	DB	93
	DB	10
	DB	0
	DB	65
	DB	83
	DB	68
	DB	70
	DB	71
	DB	72
	DB	74
	DB	75
	DB	76
	DB	59
	DB	39
	DB	96
	DB	0
	DB	92
	DB	90
	DB	88
	DB	67
	DB	86
	DB	66
	DB	78
	DB	77
	DB	44
	DB	46
	DB	47
	DB	0
	DB	42
	DB	0
	DB	32
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	55
	DB	0
	DB	57
	DB	45
	DB	52
	DB	53
	DB	54
	DB	43
	DB	49
	DB	0
	DB	51
	DB	48
	DB	46
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	92
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	92
	DB	0
	DB	0
_keytable1.1:
	DB	0
	DB	0
	DB	33
	DB	64
	DB	35
	DB	36
	DB	37
	DB	94
	DB	38
	DB	42
	DB	40
	DB	41
	DB	95
	DB	43
	DB	8
	DB	0
	DB	81
	DB	87
	DB	69
	DB	82
	DB	84
	DB	89
	DB	85
	DB	73
	DB	79
	DB	80
	DB	123
	DB	125
	DB	10
	DB	0
	DB	65
	DB	83
	DB	68
	DB	70
	DB	71
	DB	72
	DB	74
	DB	75
	DB	76
	DB	58
	DB	34
	DB	126
	DB	0
	DB	124
	DB	90
	DB	88
	DB	67
	DB	86
	DB	66
	DB	78
	DB	77
	DB	60
	DB	62
	DB	63
	DB	0
	DB	42
	DB	0
	DB	32
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	55
	DB	56
	DB	57
	DB	45
	DB	52
	DB	53
	DB	54
	DB	43
	DB	49
	DB	50
	DB	51
	DB	48
	DB	46
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	95
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	0
	DB	124
	DB	0
	DB	0
LC0:
	DB	"HZK16.fnt",0x00
LC3:
	DB	"%d-%d-%d",0x00
LC4:
	DB	"%d:%d",0x00
LC1:
	DB	0x0A,"Break(key) :",0x0A,0x00
LC2:
	DB	0x0A,"Break(mouse) :",0x0A,0x00
[SECTION .text]
	GLOBAL	_HariMain
_HariMain:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EDI
	PUSH	ESI
	PUSH	EBX
	LEA	ESI,DWORD [-124+EBP]
	SUB	ESP,1884
	LEA	EBX,DWORD [-92+EBP]
	MOV	DWORD [-1824+EBP],-1
	MOV	DWORD [-1828+EBP],0
	MOV	DWORD [-1832+EBP],2147483647
	MOV	DWORD [-1836+EBP],0
	MOV	DWORD [-1856+EBP],0
	MOV	AL,BYTE [4081]
	SAR	AL,4
	MOV	EDX,EAX
	AND	EDX,7
	MOV	DWORD [-1860+EBP],EDX
	MOV	DWORD [-1864+EBP],-1
	MOV	DWORD [-1868+EBP],-1
	MOV	DWORD [-1872+EBP],-1
	MOV	DWORD [-1876+EBP],0
	MOV	DWORD [-1880+EBP],0
	CALL	_init_gdtidt
	CALL	_init_pic
	CALL	_io_sti
	LEA	EAX,DWORD [-636+EBP]
	PUSH	0
	PUSH	EAX
	PUSH	128
	PUSH	EBX
	CALL	_fifo32_init
	MOV	DWORD [4076],EBX
	CALL	_init_pit
	PUSH	256
	PUSH	EBX
	CALL	_init_keyboard
	LEA	EAX,DWORD [-780+EBP]
	PUSH	EAX
	PUSH	512
	PUSH	EBX
	CALL	_enable_mouse
	ADD	ESP,36
	PUSH	248
	PUSH	33
	CALL	_io_out8
	PUSH	239
	PUSH	161
	CALL	_io_out8
	LEA	EAX,DWORD [-764+EBP]
	PUSH	0
	PUSH	EAX
	PUSH	32
	PUSH	ESI
	CALL	_fifo32_init
	ADD	ESP,32
	PUSH	-1073741825
	PUSH	4194304
	CALL	_memtest
	PUSH	3932160
	MOV	DWORD [-1840+EBP],EAX
	CALL	_memman_init
	PUSH	647168
	PUSH	4096
	PUSH	3932160
	CALL	_memman_free
	MOV	EAX,DWORD [-1840+EBP]
	SUB	EAX,4194304
	PUSH	EAX
	PUSH	4194304
	PUSH	3932160
	CALL	_memman_free
	ADD	ESP,36
	MOVSX	EAX,WORD [4086]
	PUSH	EAX
	MOVSX	EAX,WORD [4084]
	PUSH	EAX
	PUSH	DWORD [4088]
	PUSH	3932160
	CALL	_shtctl_init
	PUSH	3932160
	MOV	DWORD [-1812+EBP],EAX
	CALL	_task_init
	PUSH	2
	PUSH	1
	MOV	DWORD [-1852+EBP],EAX
	PUSH	EAX
	MOV	DWORD [-68+EBP],EAX
	CALL	_task_run
	ADD	ESP,32
	MOV	EDX,DWORD [-1852+EBP]
	MOV	EAX,DWORD [-1812+EBP]
	MOV	DWORD [4068],EAX
	MOV	BYTE [188+EDX],2
	PUSH	EAX
	CALL	_sheet_alloc
	MOVSX	EDX,WORD [4086]
	MOV	DWORD [-1844+EBP],EAX
	MOVSX	EAX,WORD [4084]
	IMUL	EAX,EDX
	SAL	EAX,2
	PUSH	EAX
	PUSH	3932160
	CALL	_memman_alloc_4k
	PUSH	-1
	MOV	EBX,EAX
	MOVSX	EAX,WORD [4086]
	PUSH	EAX
	MOVSX	EAX,WORD [4084]
	PUSH	EAX
	PUSH	EBX
	PUSH	DWORD [-1844+EBP]
	CALL	_sheet_setbuf
	ADD	ESP,32
	MOVSX	EAX,WORD [4086]
	PUSH	EAX
	MOVSX	EAX,WORD [4084]
	PUSH	EAX
	PUSH	EBX
	LEA	EBX,DWORD [-1804+EBP]
	CALL	_init_screen8
	PUSH	DWORD [-1812+EBP]
	CALL	_sheet_alloc
	PUSH	99
	PUSH	16
	PUSH	16
	MOV	DWORD [-1848+EBP],EAX
	PUSH	EBX
	PUSH	EAX
	CALL	_sheet_setbuf
	ADD	ESP,36
	PUSH	99
	PUSH	EBX
	MOV	EBX,2
	CALL	_init_mouse_cursor8
	MOVSX	EAX,WORD [4084]
	LEA	ECX,DWORD [-16+EAX]
	MOV	EAX,ECX
	CDQ
	IDIV	EBX
	MOV	DWORD [-1816+EBP],EAX
	MOVSX	EAX,WORD [4086]
	PUSH	0
	LEA	ECX,DWORD [-44+EAX]
	PUSH	0
	MOV	EAX,ECX
	CDQ
	IDIV	EBX
	PUSH	DWORD [-1844+EBP]
	MOV	DWORD [-1820+EBP],EAX
	CALL	_sheet_slide
	PUSH	4
	PUSH	32
	PUSH	DWORD [-1884+EBP]
	CALL	_sheet_slide
	ADD	ESP,32
	PUSH	DWORD [-1820+EBP]
	PUSH	DWORD [-1816+EBP]
	PUSH	DWORD [-1848+EBP]
	CALL	_sheet_slide
	PUSH	0
	PUSH	DWORD [-1844+EBP]
	CALL	_sheet_updown
	PUSH	1
	PUSH	DWORD [-1884+EBP]
	CALL	_sheet_updown
	PUSH	2
	PUSH	DWORD [-1848+EBP]
	CALL	_sheet_updown
	ADD	ESP,36
	PUSH	DWORD [-1884+EBP]
	CALL	_keywin_on
	PUSH	237
	PUSH	ESI
	CALL	_fifo32_put
	PUSH	DWORD [-1860+EBP]
	PUSH	ESI
	CALL	_fifo32_put
	PUSH	764832
	PUSH	3932160
	CALL	_memman_alloc_4k
	PUSH	11520
	PUSH	3932160
	CALL	_memman_alloc_4k
	ADD	ESP,36
	MOV	EBX,EAX
	PUSH	1049088
	PUSH	EAX
	CALL	_file_readfat
	PUSH	224
	PUSH	1058304
	PUSH	LC0
	CALL	_file_search
	ADD	ESP,20
	MOV	EDX,EAX
	TEST	EAX,EAX
	JE	L2
	MOV	EAX,DWORD [28+EAX]
	PUSH	EBX
	MOV	DWORD [-1808+EBP],EAX
	LEA	EAX,DWORD [-1808+EBP]
	PUSH	EAX
	MOVZX	EAX,WORD [26+EDX]
	PUSH	EAX
	CALL	_file_loadfile2
	ADD	ESP,12
	MOV	ECX,EAX
L3:
	MOV	DWORD [4072],ECX
	PUSH	11520
	PUSH	EBX
	PUSH	3932160
	CALL	_memman_free_4k
	ADD	ESP,12
	CMP	DWORD [-1884+EBP],0
	JE	L14
	PUSH	DWORD [-1884+EBP]
	CALL	_keywin_off
	POP	ECX
L14:
	PUSH	DWORD [-1840+EBP]
	PUSH	DWORD [-1812+EBP]
	CALL	_open_console
	PUSH	4
	PUSH	32
	PUSH	EAX
	MOV	DWORD [-1884+EBP],EAX
	CALL	_sheet_slide
	MOV	EDX,DWORD [-1812+EBP]
	PUSH	DWORD [16+EDX]
	PUSH	DWORD [-1884+EBP]
	CALL	_sheet_updown
	PUSH	DWORD [-1884+EBP]
	CALL	_keywin_on
	ADD	ESP,32
L15:
	LEA	EBX,DWORD [-124+EBP]
	PUSH	EBX
	CALL	_fifo32_status
	POP	EDX
	TEST	EAX,EAX
	JLE	L18
	CMP	DWORD [-1864+EBP],0
	JS	L93
L18:
	LEA	EBX,DWORD [-92+EBP]
	CALL	_io_cli
	PUSH	EBX
	CALL	_fifo32_status
	POP	EDI
	TEST	EAX,EAX
	JE	L94
	PUSH	EBX
	CALL	_fifo32_get
	MOV	DWORD [-1808+EBP],EAX
	CALL	_io_sti
	POP	EBX
	CMP	DWORD [-1884+EBP],0
	JE	L25
	MOV	EAX,DWORD [-1884+EBP]
	CMP	DWORD [28+EAX],0
	JNE	L25
	MOV	EDX,DWORD [-1812+EBP]
	MOV	DWORD [-1884+EBP],0
	MOV	EAX,DWORD [16+EDX]
	CMP	EAX,1
	JE	L25
	MOV	EDX,DWORD [-1812+EBP]
	MOV	EAX,DWORD [16+EDX+EAX*4]
	PUSH	EAX
	MOV	DWORD [-1884+EBP],EAX
	CALL	_keywin_on
	POP	ECX
L25:
	MOV	EDX,DWORD [-1808+EBP]
	LEA	EAX,DWORD [-256+EDX]
	CMP	EAX,255
	JA	L28
	CMP	EDX,383
	JG	L29
	CMP	DWORD [-1856+EBP],0
	JNE	L30
	MOV	AL,BYTE [_keytable0.0-256+EDX]
L91:
	MOV	BYTE [-60+EBP],AL
L32:
	MOV	DL,BYTE [-60+EBP]
	LEA	EAX,DWORD [-65+EDX]
	CMP	AL,25
	JA	L33
	TEST	DWORD [-1860+EBP],4
	JNE	L88
	CMP	DWORD [-1856+EBP],0
	JE	L35
L33:
	MOV	AL,BYTE [-60+EBP]
	TEST	AL,AL
	JE	L37
	CMP	DWORD [-1884+EBP],0
	JE	L37
	MOVSX	EAX,AL
	MOV	EDX,DWORD [-1884+EBP]
	ADD	EAX,256
	PUSH	EAX
	MOV	EAX,DWORD [36+EDX]
	ADD	EAX,16
	PUSH	EAX
	CALL	_fifo32_put
	POP	EAX
	POP	EDX
L37:
	CMP	DWORD [-1808+EBP],271
	JE	L95
L38:
	MOV	EAX,DWORD [-1808+EBP]
	CMP	EAX,298
	JE	L96
L40:
	CMP	EAX,310
	JE	L97
L41:
	CMP	EAX,426
	JE	L98
L42:
	CMP	EAX,438
	JE	L99
L43:
	CMP	EAX,314
	JE	L100
L44:
	CMP	DWORD [-1808+EBP],325
	JE	L101
L45:
	CMP	DWORD [-1808+EBP],326
	JE	L102
L46:
	CMP	DWORD [-1808+EBP],315
	JE	L103
L47:
	CMP	DWORD [-1808+EBP],316
	JE	L104
L49:
	CMP	DWORD [-1808+EBP],343
	JE	L105
L51:
	MOV	EAX,DWORD [-1808+EBP]
	CMP	EAX,506
	JE	L106
L52:
	CMP	EAX,510
	JE	L107
L54:
	LEA	EBX,DWORD [-60+EBP]
	CALL	_get_day_of_month
	PUSH	EAX
	CALL	_get_mon_hex
	PUSH	EAX
	CALL	_get_year
	PUSH	EAX
	PUSH	LC3
	PUSH	EBX
	CALL	_sprintf
	PUSH	15
	PUSH	EBX
	PUSH	16448250
	PUSH	0
	MOVSX	EAX,WORD [4086]
	SUB	EAX,20
	PUSH	EAX
	MOVSX	EAX,WORD [4084]
	SUB	EAX,180
	PUSH	EAX
	PUSH	DWORD [-1844+EBP]
	CALL	_putfonts8_asc_sht
	ADD	ESP,48
	CALL	_get_min_hex
	PUSH	EAX
	CALL	_get_hour_hex
	PUSH	EAX
	PUSH	LC4
	PUSH	EBX
	CALL	_sprintf
	PUSH	5
	PUSH	EBX
	PUSH	16448250
	PUSH	0
	MOVSX	EAX,WORD [4086]
	SUB	EAX,20
	PUSH	EAX
	MOVSX	EAX,WORD [4084]
	SUB	EAX,45
	PUSH	EAX
	PUSH	DWORD [-1844+EBP]
	CALL	_putfonts8_asc_sht
	ADD	ESP,44
	MOVSX	EAX,WORD [4086]
	SUB	EAX,34
	PUSH	EAX
	MOVSX	EAX,WORD [4084]
	SUB	EAX,5
	PUSH	EAX
	MOVSX	EAX,WORD [4086]
	SUB	EAX,20
	PUSH	EAX
	MOVSX	EAX,WORD [4084]
	SUB	EAX,130
	PUSH	EAX
	PUSH	DWORD [-1844+EBP]
	CALL	_sheet_refresh
	ADD	ESP,20
	JMP	L15
L107:
	CALL	_wait_KBC_sendready
	PUSH	DWORD [-1864+EBP]
	PUSH	96
	CALL	_io_out8
	POP	EBX
	POP	ESI
	JMP	L54
L106:
	MOV	DWORD [-1864+EBP],-1
	JMP	L52
L105:
	MOV	EDX,DWORD [-1812+EBP]
	MOV	EAX,DWORD [16+EDX]
	DEC	EAX
	PUSH	EAX
	PUSH	DWORD [24+EDX]
	CALL	_sheet_updown
	POP	EDI
	POP	EAX
	JMP	L51
L104:
	CMP	DWORD [-1856+EBP],0
	JE	L49
	CMP	DWORD [-1884+EBP],0
	JE	L50
	PUSH	DWORD [-1884+EBP]
	CALL	_keywin_off
	POP	EAX
L50:
	PUSH	DWORD [-1840+EBP]
	PUSH	DWORD [-1812+EBP]
	CALL	_open_console
	PUSH	4
	PUSH	32
	PUSH	EAX
	MOV	DWORD [-1884+EBP],EAX
	CALL	_sheet_slide
	MOV	EAX,DWORD [-1812+EBP]
	PUSH	DWORD [16+EAX]
	PUSH	DWORD [-1884+EBP]
	CALL	_sheet_updown
	PUSH	DWORD [-1884+EBP]
	CALL	_keywin_on
	ADD	ESP,32
	JMP	L49
L103:
	CMP	DWORD [-1856+EBP],0
	JE	L47
	CMP	DWORD [-1884+EBP],0
	JE	L47
	MOV	EDX,DWORD [-1884+EBP]
	MOV	EBX,DWORD [36+EDX]
	TEST	EBX,EBX
	JE	L47
	CMP	DWORD [52+EBX],0
	JE	L47
	PUSH	LC1
	PUSH	DWORD [164+EBX]
	CALL	_cons_putstr0
	CALL	_io_cli
	LEA	EAX,DWORD [48+EBX]
	MOV	DWORD [84+EBX],EAX
	MOV	DWORD [76+EBX],_asm_end_app
	CALL	_io_sti
	PUSH	0
	PUSH	-1
	PUSH	EBX
	CALL	_task_run
	ADD	ESP,20
	JMP	L47
L102:
	PUSH	237
	LEA	EBX,DWORD [-124+EBP]
	PUSH	EBX
	XOR	DWORD [-1860+EBP],1
	CALL	_fifo32_put
	PUSH	DWORD [-1860+EBP]
	PUSH	EBX
	CALL	_fifo32_put
	ADD	ESP,16
	JMP	L46
L101:
	PUSH	237
	LEA	EBX,DWORD [-124+EBP]
	PUSH	EBX
	XOR	DWORD [-1860+EBP],2
	CALL	_fifo32_put
	PUSH	DWORD [-1860+EBP]
	PUSH	EBX
	CALL	_fifo32_put
	ADD	ESP,16
	JMP	L45
L100:
	PUSH	237
	LEA	EBX,DWORD [-124+EBP]
	PUSH	EBX
	XOR	DWORD [-1860+EBP],4
	CALL	_fifo32_put
	PUSH	DWORD [-1860+EBP]
	PUSH	EBX
	CALL	_fifo32_put
	ADD	ESP,16
	JMP	L44
L99:
	AND	DWORD [-1856+EBP],-3
	JMP	L43
L98:
	AND	DWORD [-1856+EBP],-2
	JMP	L42
L97:
	OR	DWORD [-1856+EBP],2
	JMP	L41
L96:
	OR	DWORD [-1856+EBP],1
	JMP	L40
L95:
	CMP	DWORD [-1884+EBP],0
	JE	L38
	PUSH	DWORD [-1884+EBP]
	CALL	_keywin_off
	POP	EAX
	MOV	EAX,DWORD [-1884+EBP]
	MOV	EBX,DWORD [24+EAX]
	DEC	EBX
	JNE	L39
	MOV	EDX,DWORD [-1812+EBP]
	MOV	EBX,DWORD [16+EDX]
	DEC	EBX
L39:
	MOV	EAX,DWORD [-1812+EBP]
	MOV	EBX,DWORD [20+EAX+EBX*4]
	PUSH	EBX
	MOV	DWORD [-1884+EBP],EBX
	CALL	_keywin_on
	POP	EAX
	JMP	L38
L35:
	LEA	EAX,DWORD [32+EDX]
	MOV	BYTE [-60+EBP],AL
	JMP	L33
L88:
	CMP	DWORD [-1856+EBP],0
	JE	L33
	JMP	L35
L30:
	MOV	AL,BYTE [_keytable1.1-256+EDX]
	JMP	L91
L29:
	MOV	BYTE [-60+EBP],0
	JMP	L32
L28:
	LEA	EAX,DWORD [-512+EDX]
	CMP	EAX,255
	JA	L55
	MOVZX	EAX,BYTE [-1808+EBP]
	PUSH	EAX
	LEA	EAX,DWORD [-780+EBP]
	PUSH	EAX
	CALL	_mouse_decode
	POP	EDX
	POP	ECX
	TEST	EAX,EAX
	JE	L54
	MOV	EAX,DWORD [-772+EBP]
	MOV	EDX,DWORD [-776+EBP]
	ADD	DWORD [-1820+EBP],EAX
	ADD	DWORD [-1816+EBP],EDX
	JS	L108
L57:
	CMP	DWORD [-1820+EBP],0
	JS	L109
L58:
	MOVSX	EAX,WORD [4084]
	DEC	EAX
	CMP	DWORD [-1816+EBP],EAX
	JLE	L59
	MOV	DWORD [-1816+EBP],EAX
L59:
	MOVSX	EAX,WORD [4086]
	DEC	EAX
	CMP	DWORD [-1820+EBP],EAX
	JLE	L60
	MOV	DWORD [-1820+EBP],EAX
L60:
	MOV	EAX,DWORD [-1816+EBP]
	MOV	EDX,DWORD [-1820+EBP]
	MOV	DWORD [-1824+EBP],EAX
	MOV	DWORD [-1828+EBP],EDX
	TEST	DWORD [-768+EBP],1
	JE	L61
	CMP	DWORD [-1868+EBP],0
	JS	L110
	MOV	ESI,DWORD [-1816+EBP]
	MOV	EAX,DWORD [-1876+EBP]
	SUB	ESI,DWORD [-1868+EBP]
	MOV	EDI,DWORD [-1820+EBP]
	SUB	EDI,DWORD [-1872+EBP]
	MOV	EDX,DWORD [-1820+EBP]
	LEA	ESI,DWORD [2+ESI+EAX*1]
	MOV	DWORD [-1872+EBP],EDX
	MOV	DWORD [-1832+EBP],ESI
	ADD	DWORD [-1836+EBP],EDI
	AND	DWORD [-1832+EBP],-4
	JMP	L54
L110:
	MOV	EAX,DWORD [-1812+EBP]
	MOV	EAX,DWORD [16+EAX]
	MOV	EBX,EAX
	MOV	DWORD [-1892+EBP],EAX
	DEC	EBX
	TEST	EBX,EBX
	JLE	L54
L74:
	MOV	EDX,DWORD [-1812+EBP]
	MOV	EDI,DWORD [-1820+EBP]
	MOV	ESI,DWORD [-1816+EBP]
	MOV	EDX,DWORD [20+EDX+EBX*4]
	MOV	DWORD [-1880+EBP],EDX
	SUB	EDI,DWORD [16+EDX]
	SUB	ESI,DWORD [12+EDX]
	JS	L65
	MOV	EAX,DWORD [4+EDX]
	CMP	ESI,EAX
	JGE	L65
	TEST	EDI,EDI
	JS	L65
	CMP	EDI,DWORD [8+EDX]
	JGE	L65
	IMUL	EAX,EDI
	ADD	EAX,ESI
	MOV	ECX,DWORD [EDX]
	MOV	DWORD [-1896+EBP],EAX
	MOV	EDX,DWORD [20+EDX]
	MOV	EAX,DWORD [-1896+EBP]
	CMP	DWORD [ECX+EAX*4],EDX
	JNE	L111
L65:
	DEC	EBX
	TEST	EBX,EBX
	JG	L74
	JMP	L54
L111:
	MOV	EAX,DWORD [-1892+EBP]
	DEC	EAX
	PUSH	EAX
	PUSH	DWORD [-1880+EBP]
	CALL	_sheet_updown
	MOV	EDX,DWORD [-1884+EBP]
	POP	EBX
	CMP	DWORD [-1880+EBP],EDX
	POP	EAX
	JE	L69
	PUSH	EDX
	CALL	_keywin_off
	MOV	EAX,DWORD [-1880+EBP]
	PUSH	EAX
	MOV	DWORD [-1884+EBP],EAX
	CALL	_keywin_on
	POP	EDX
	POP	ECX
L69:
	CMP	ESI,2
	JLE	L70
	MOV	EDX,DWORD [-1880+EBP]
	MOV	EAX,DWORD [4+EDX]
	SUB	EAX,3
	CMP	ESI,EAX
	JGE	L70
	CMP	EDI,2
	JLE	L70
	CMP	EDI,20
	JG	L70
	MOV	EAX,DWORD [-1816+EBP]
	MOV	EDX,DWORD [-1820+EBP]
	MOV	DWORD [-1868+EBP],EAX
	MOV	DWORD [-1872+EBP],EDX
	MOV	EAX,DWORD [-1880+EBP]
	MOV	EDX,DWORD [-1880+EBP]
	MOV	EAX,DWORD [12+EAX]
	MOV	EDX,DWORD [16+EDX]
	MOV	DWORD [-1876+EBP],EAX
	MOV	DWORD [-1836+EBP],EDX
L70:
	MOV	EAX,DWORD [-1880+EBP]
	MOV	EDX,DWORD [4+EAX]
	LEA	EAX,DWORD [-21+EDX]
	CMP	EAX,ESI
	JG	L54
	LEA	EAX,DWORD [-5+EDX]
	CMP	ESI,EAX
	JGE	L54
	CMP	EDI,4
	JLE	L54
	CMP	EDI,18
	JG	L54
	MOV	EDX,DWORD [-1880+EBP]
	TEST	BYTE [28+EDX],16
	JNE	L89
	MOV	EBX,DWORD [36+EDX]
	PUSH	-1
	PUSH	EDX
	CALL	_sheet_updown
	PUSH	DWORD [-1884+EBP]
	CALL	_keywin_off
	MOV	EDX,DWORD [-1812+EBP]
	MOV	EAX,DWORD [16+EDX]
	MOV	EAX,DWORD [16+EDX+EAX*4]
	PUSH	EAX
	MOV	DWORD [-1884+EBP],EAX
	CALL	_keywin_on
	CALL	_io_cli
	LEA	EAX,DWORD [16+EBX]
	PUSH	4
	PUSH	EAX
	CALL	_fifo32_put
	CALL	_io_sti
	ADD	ESP,24
	JMP	L54
L89:
	MOV	EAX,DWORD [-1880+EBP]
	MOV	EBX,DWORD [36+EAX]
	PUSH	LC2
	PUSH	DWORD [164+EBX]
	CALL	_cons_putstr0
	CALL	_io_cli
	LEA	EAX,DWORD [48+EBX]
	MOV	DWORD [84+EBX],EAX
	MOV	DWORD [76+EBX],_asm_end_app
	CALL	_io_sti
	PUSH	0
	PUSH	-1
	PUSH	EBX
	CALL	_task_run
	ADD	ESP,20
	JMP	L54
L61:
	MOV	DWORD [-1868+EBP],-1
	CMP	DWORD [-1832+EBP],2147483647
	JE	L54
	PUSH	DWORD [-1836+EBP]
	PUSH	DWORD [-1832+EBP]
	PUSH	DWORD [-1880+EBP]
	CALL	_sheet_slide
	ADD	ESP,12
	MOV	DWORD [-1832+EBP],2147483647
	JMP	L54
L109:
	MOV	DWORD [-1820+EBP],0
	JMP	L58
L108:
	MOV	DWORD [-1816+EBP],0
	JMP	L57
L55:
	LEA	EAX,DWORD [-768+EDX]
	CMP	EAX,255
	JA	L79
	IMUL	EAX,EDX,40
	MOV	EDX,DWORD [-1812+EBP]
	LEA	EAX,DWORD [-29676+EAX+EDX*1]
	PUSH	EAX
	CALL	_close_console
L92:
	POP	EAX
	JMP	L54
L79:
	LEA	EAX,DWORD [-1024+EDX]
	CMP	EAX,999
	JA	L81
	IMUL	EDX,EDX,192
	ADD	EDX,DWORD [_taskctl]
	LEA	EAX,DWORD [-192520+EDX]
	PUSH	EAX
	CALL	_close_constask
	JMP	L92
L81:
	LEA	EAX,DWORD [-2024+EDX]
	CMP	EAX,255
	JA	L54
	IMUL	EAX,EDX,40
	ADD	EAX,DWORD [-1812+EBP]
	PUSH	42240
	PUSH	DWORD [-79916+EAX]
	PUSH	3932160
	LEA	EBX,DWORD [-79916+EAX]
	CALL	_memman_free_4k
	PUSH	EBX
	CALL	_sheet_free
	ADD	ESP,16
	JMP	L54
L94:
	CMP	DWORD [-1824+EBP],0
	JNS	L112
	CMP	DWORD [-1832+EBP],2147483647
	JNE	L113
	PUSH	DWORD [-1852+EBP]
	CALL	_task_sleep
	CALL	_io_sti
	POP	ESI
	JMP	L15
L113:
	CALL	_io_sti
	PUSH	DWORD [-1836+EBP]
	PUSH	DWORD [-1832+EBP]
	PUSH	DWORD [-1880+EBP]
	CALL	_sheet_slide
	MOV	DWORD [-1832+EBP],2147483647
L90:
	ADD	ESP,12
	JMP	L15
L112:
	CALL	_io_sti
	PUSH	DWORD [-1828+EBP]
	PUSH	DWORD [-1824+EBP]
	PUSH	DWORD [-1848+EBP]
	CALL	_sheet_slide
	MOV	DWORD [-1824+EBP],-1
	JMP	L90
L93:
	PUSH	EBX
	CALL	_fifo32_get
	MOV	DWORD [-1864+EBP],EAX
	CALL	_wait_KBC_sendready
	PUSH	DWORD [-1864+EBP]
	PUSH	96
	CALL	_io_out8
	ADD	ESP,12
	JMP	L18
L2:
	PUSH	145472
	PUSH	3932160
	CALL	_memman_alloc_4k
	XOR	EDX,EDX
	POP	ESI
	MOV	ECX,EAX
	MOV	DWORD [-1808+EBP],0
	POP	EDI
L8:
	MOV	AL,BYTE [_hankaku+EDX]
	MOV	BYTE [EDX+ECX*1],AL
	MOV	EAX,DWORD [-1808+EBP]
	INC	EAX
	MOV	DWORD [-1808+EBP],EAX
	MOV	EDX,EAX
	CMP	EAX,4095
	JLE	L8
	MOV	DWORD [-1808+EBP],4096
	MOV	EAX,4096
L13:
	MOV	BYTE [EAX+ECX*1],-1
	MOV	EAX,DWORD [-1808+EBP]
	INC	EAX
	MOV	DWORD [-1808+EBP],EAX
	CMP	EAX,145471
	JLE	L13
	JMP	L3
	GLOBAL	_keywin_off
_keywin_off:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	0
	MOV	EBX,DWORD [8+EBP]
	PUSH	EBX
	CALL	_change_wtitle8
	TEST	BYTE [28+EBX],32
	POP	ECX
	POP	EAX
	JNE	L116
L114:
	MOV	EBX,DWORD [-4+EBP]
	LEAVE
	RET
L116:
	PUSH	3
	MOV	EAX,DWORD [36+EBX]
	ADD	EAX,16
	PUSH	EAX
	CALL	_fifo32_put
	POP	EAX
	POP	EDX
	JMP	L114
	GLOBAL	_keywin_on
_keywin_on:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	PUSH	1
	MOV	EBX,DWORD [8+EBP]
	PUSH	EBX
	CALL	_change_wtitle8
	TEST	BYTE [28+EBX],32
	POP	ECX
	POP	EAX
	JNE	L119
L117:
	MOV	EBX,DWORD [-4+EBP]
	LEAVE
	RET
L119:
	PUSH	2
	MOV	EAX,DWORD [36+EBX]
	ADD	EAX,16
	PUSH	EAX
	CALL	_fifo32_put
	POP	EAX
	POP	EDX
	JMP	L117
	GLOBAL	_open_constask
_open_constask:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	ESI
	PUSH	EBX
	CALL	_task_alloc
	PUSH	512
	PUSH	3932160
	MOV	EBX,EAX
	CALL	_memman_alloc_4k
	PUSH	65536
	PUSH	3932160
	MOV	ESI,EAX
	CALL	_memman_alloc_4k
	MOV	EDX,DWORD [8+EBP]
	MOV	DWORD [76+EBX],_console_task
	MOV	DWORD [172+EBX],EAX
	ADD	EAX,65524
	MOV	DWORD [100+EBX],EAX
	MOV	DWORD [116+EBX],8
	MOV	DWORD [120+EBX],16
	MOV	DWORD [124+EBX],8
	MOV	DWORD [128+EBX],8
	MOV	DWORD [132+EBX],8
	MOV	DWORD [136+EBX],8
	MOV	DWORD [4+EAX],EDX
	MOV	EDX,DWORD [100+EBX]
	MOV	EAX,DWORD [12+EBP]
	MOV	DWORD [8+EDX],EAX
	PUSH	2
	PUSH	2
	PUSH	EBX
	CALL	_task_run
	LEA	EAX,DWORD [16+EBX]
	PUSH	EBX
	PUSH	ESI
	PUSH	128
	PUSH	EAX
	CALL	_fifo32_init
	LEA	ESP,DWORD [-8+EBP]
	MOV	EAX,EBX
	POP	EBX
	POP	ESI
	POP	EBP
	RET
[SECTION .data]
LC5:
	DB	"WonderfulOS -",0xBF,0xD8,0xD6,0xC6,0xCC,0xA8,0x00
[SECTION .text]
	GLOBAL	_open_console
_open_console:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	ESI
	PUSH	EBX
	PUSH	DWORD [8+EBP]
	CALL	_sheet_alloc
	PUSH	251475
	PUSH	3932160
	MOV	EBX,EAX
	CALL	_memman_alloc_4k
	PUSH	255
	PUSH	479
	MOV	ESI,EAX
	PUSH	525
	PUSH	EAX
	PUSH	EBX
	CALL	_sheet_setbuf
	ADD	ESP,32
	PUSH	0
	PUSH	LC5
	PUSH	479
	PUSH	525
	PUSH	ESI
	CALL	_make_window8
	PUSH	0
	PUSH	452
	PUSH	519
	PUSH	24
	PUSH	3
	PUSH	EBX
	CALL	_make_textbox8
	ADD	ESP,44
	PUSH	DWORD [12+EBP]
	PUSH	EBX
	CALL	_open_constask
	OR	DWORD [28+EBX],32
	MOV	DWORD [36+EBX],EAX
	LEA	ESP,DWORD [-8+EBP]
	MOV	EAX,EBX
	POP	EBX
	POP	ESI
	POP	EBP
	RET
	GLOBAL	_close_constask
_close_constask:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	EBX
	MOV	EBX,DWORD [8+EBP]
	PUSH	EBX
	CALL	_task_sleep
	PUSH	65536
	PUSH	DWORD [172+EBX]
	PUSH	3932160
	CALL	_memman_free_4k
	PUSH	512
	PUSH	DWORD [16+EBX]
	PUSH	3932160
	CALL	_memman_free_4k
	MOV	DWORD [4+EBX],0
	MOV	EBX,DWORD [-4+EBP]
	LEAVE
	RET
	GLOBAL	_close_console
_close_console:
	PUSH	EBP
	MOV	EBP,ESP
	PUSH	ESI
	PUSH	EBX
	MOV	EBX,DWORD [8+EBP]
	MOV	ESI,DWORD [36+EBX]
	PUSH	168960
	PUSH	DWORD [EBX]
	PUSH	3932160
	CALL	_memman_free_4k
	PUSH	EBX
	CALL	_sheet_free
	MOV	DWORD [8+EBP],ESI
	ADD	ESP,16
	LEA	ESP,DWORD [-8+EBP]
	POP	EBX
	POP	ESI
	POP	EBP
	JMP	_close_constask
